export const TOKEN_KEY = 'xxx_token'

// 存储数据
export const setLocalToken = val => {
  if (typeof val === 'object') {
    val = JSON.stringify(val)
  }
  localStorage.setItem(TOKEN_KEY, val)
}
// 获取数据
export const getLocalToken = () => {
  const data = localStorage.getItem(TOKEN_KEY)
  try {
    return JSON.parse(data)
  } catch (err) {
    return data
  }
}
// 删除数据
export const removeLocalToken = () => {
  localStorage.removeItem(TOKEN_KEY)
}
